using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;

namespace Umdf.SideShow.Contents
{
    public class ImageContent : Content
    {
        private Image _image;
        private ImageFormat _format;

        public ImageContent()
        {
        }

        public ImageContent(uint id, Image image)
            : base(id)
        {
            _image = new Bitmap(image);
            //_format = image.RawFormat;
        }

        
        public Image Image
        {
            get { return _image; }
        }

        
        protected internal override void DeserializeObject(BinaryReader reader)
        {
            base.DeserializeObject(reader);
            byte[] buf = reader.ReadBytes(16);
            Guid f = new Guid(buf);
            
            
            //_format = new ImageFormat(f);
            int l = reader.ReadInt32();
            buf = reader.ReadBytes(l);
            using (MemoryStream ms = new MemoryStream(buf))
            {
                _image = new Bitmap(ms);
            }
        }

        
    }
}
